package fem2.element.crack_sda;

import inf.jlinalg.Array1DMatrix;
import inf.jlinalg.IMatrix;
import fem2.MaterialModel;
import fem2.MeshPart;
import fem2.enu.StressType;
import fem2.material.cohesive_law.CohesiveLaw;

public class KOSConstantJumpCSTElement extends SOSConstantJumpCSTElement2 {

	public KOSConstantJumpCSTElement(MeshPart mp, MaterialModel mm, CohesiveLaw cl) {
		super(mp, mm, cl);
	}

	public KOSConstantJumpCSTElement(MeshPart mp, MaterialModel mm, CohesiveLaw cl,
			StressType stressType) {
		super(mp, mm, cl, stressType);
	}

	@Override
	protected void computeEnhancedStrainOperator(MeshPart mp, IMatrix g, double... xi) {
		int dim = mp.getDimension();
		int nn = mp.countModes();
		int ntrs = dim * (dim + 1) / 2;
		Array1DMatrix B = Array1DMatrix.createColumnMajor(ntrs, dim * nn);
		computeB(mp, B, xi);
		int shift = dim * posNode;
		g.set(0, 0, -B.get(0, shift));
		g.set(1, 1, -B.get(1, 1 + shift));
		g.set(2, 0, -B.get(2, shift));
		g.set(2, 1, -B.get(2, 1 + shift));
	}

}
